package com.ty.day4;

/**
 * Created by IntelliJ IDEA.
 * Author : txy
 * Create 2023/10/31 17:04
 */
public class Eight {
    public static void main(String[] args) {
        System.out.println("100以内的素数有：");
        for (int i = 2; i < 100; i++) {
            if (Prime(i)) {
                System.out.print(i + " ");
            }
        }
    }

    public static boolean Prime(int a) {
        if (a <= 1) {
            return true;
        }
        for (int i = 2; i <= Math.sqrt(a); i++) {
            if (a % i == 0) {
                return false;
            }
        }
        return true;
    }
}
